﻿using Newtonsoft.Json;
using System;
using System.Configuration;
using System.Drawing.Printing;
using System.IO;
using System.Windows.Forms;
using Spire.Pdf;
using Tzw.Common;
using System.Linq;
using System.Net;

namespace JTG.CheckInMachine
{
    static class Program
    {
        /// <summary>
        /// 应用程序的主入口点。
        /// </summary>
        [STAThread]
        static void Main()
        {
            #region 打印测试

            //初始化打印信息
            //var fillDataSet = new List<SignInfo>
            //{
            //    new SignInfo()
            //    {
            //        QueueNo = "排队号码",
            //        PatientName = "病人姓名",
            //        DoctorName = "医生姓名",
            //        OfficeName = "诊室姓名",
            //        SignTime = "签到时间",
            //        OfficePs = "位置",
            //        SingStatus = SignStatus.BackSign
            //    }
            //}.FillDataSet();

            //打印签到信息
            //ReportHelper.DesignPort("signinfo.frx", fillDataSet);
            //ReportHelper.Print(fillDataSet, "signinfo");

            #endregion

            WebRequest.DefaultWebProxy = null;//禁用HTTP代理

            bool isRuned;
            System.Threading.Mutex mutex = new System.Threading.Mutex(true, "JTG.CheckInMachine", out isRuned);
            if (!isRuned) return;

            //加载全局配置
            App.GlobSettings = JsonConvert.DeserializeObject<Settings>(File.ReadAllText("AppSettings.json"));

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            switch (App.GlobSettings.HospitalName)
            {
                case "宜宾市妇幼保健院":
                    Application.Run(new Ybfby.ReadCard(1024, 768));
                    break;
                case "资中中医医院":
                    Application.Run(new Zzzyy.ReadCard(1024, 768));
                    break;
                default://隆昌妇幼保健院
                    Application.Run(new Main());
                    break;
            }
        }
    }
}